import { Row } from "antd";
import defaultData from "./data";
import Props from "../base/Props";
import { WeaInput, WeaLocaleProvider, WeaCheckbox, WeaMap } from "ecCom";
import classNames from 'classnames';
import { Radio } from 'antd';

const RadioGroup = Radio.Group;
const getLabel = WeaLocaleProvider.getLabel;

export default class NumberProps extends Props {

  setLocationCenter = e => {
    const value = e.target.value;

    this.handlePropChange('isSetCurrentCenter')(value);
  }

  renderContent() {
    const { location, isSetCurrentCenter } = this.props.data;

    return (
      <div className='wea-edc-map-conatiner'>
        <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@a3fb92`}>
          <label>{getLabel('502396', '地址')}</label>
          <RadioGroup ecId={`${this && this.props && this.props.ecId || ''}_RadioGroup@1w5slw`} onChange={this.setLocationCenter} value={isSetCurrentCenter}>
            <Radio ecId={`${this && this.props && this.props.ecId || ''}_Radio@qka0tp`} key="assign" value={false}>{getLabel(526735,'指定位置')}</Radio>
            <Radio ecId={`${this && this.props && this.props.ecId || ''}_Radio@dcfwje`} key="current" value={true}>{getLabel(526736,'当前位置')}</Radio>
          </RadioGroup>
        </Row>
        <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@nr44c7`} className={classNames({'wea-edc-hide': isSetCurrentCenter})}>
          <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@p3n7e0`}
            value={location}
            onBlur={this.handlePropChange('location', 800)}
          />
          <span className="map-tip">{getLabel('502507', '提示：可输入中文地址、坐标 (格式：经度,纬度)')}</span>
        </Row>
      </div>
    );
  }
}

NumberProps.defaultProps = {
  data: defaultData,
  onChange: () => { }
};